package cool.taomu.toolkit.cacheable

import com.google.common.cache.Cache
import com.google.inject.Inject

class GuavaCacheService implements ICacheService {

	@Inject
	Cache<String, byte[]> cache;

	override void put(String key, byte[] value) {
		cache.put(key, value);
	}

	override get(String key) {
		return cache.getIfPresent(key);
	}

	override void remove(String key) {
		cache.invalidate(key);
	}

	override void clear() {
		cache.cleanUp();
	}

	override put(String key, byte[] value, long expire) {
		cache.put(key, value);
	}

}
